﻿<!--
	Provided for Informational Purposes Only
	
	Apache 2.0 License
	
	Licensed under the Apache License, Version 2.0 (the "License"); you may
	not use this file except in compliance with the License. You may obtain
	a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
	
	THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
	ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY 
	IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR 
	PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
	
	See the Apache Version 2.0 License for specific language governing
	permissions and limitations under the License.
	-->
<common:LayoutAwarePage
	x:Class="ContractMeow.ModernApp.Views.LoginView"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:local="using:ContractMeow.ModernApp.Views"
	xmlns:common="using:ContractMeow.ModernApp.Common"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:cal="using:Caliburn.Micro"
	mc:Ignorable="d">

	<Page.Resources>
		<Style TargetType="TextBlock">
			<Setter Property="FontSize" Value="18"/>
			<Setter Property="Margin" Value="8"/>
			<Setter Property="Foreground" Value="#FFF"/>
			<Setter Property="VerticalAlignment" Value="Center"/>
		</Style>

		<Style TargetType="TextBox">
			<Setter Property="Margin" Value="8"/>
		</Style>

		<Style TargetType="PasswordBox">
			<Setter Property="Margin" Value="8"/>
		</Style>

	</Page.Resources>

	<Grid Style="{StaticResource LayoutRootStyle}">
		<Grid.RowDefinitions>
			<RowDefinition Height="140"/>
			<RowDefinition Height="*"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="2*"/>
		</Grid.RowDefinitions>

		<!-- Back button and page title -->
		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition Width="*"/>
			</Grid.ColumnDefinitions>
			<Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
			<TextBlock x:Name="pageTitle" Grid.Column="1" Text="Contracts Meow" Style="{StaticResource PageHeaderTextStyle}"/>
		</Grid>

		<Border Grid.Row="2"
				Background="#00BCF2"
				Padding="36">
			<Grid HorizontalAlignment="Center">
				<Grid.RowDefinitions>
					<RowDefinition/>
					<RowDefinition/>
					<RowDefinition/>
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="200"/>
					<ColumnDefinition Width="300"/>
				</Grid.ColumnDefinitions>

				<TextBlock Text="Work email"
						   Grid.Row="0" Grid.Column="0"/>

				<TextBlock Text="Password"
						   Grid.Row="1" Grid.Column="0"/>

				<TextBox x:Name="Email"
						 InputScope="EmailSmtpAddress"
						 Grid.Row="0" Grid.Column="1"/>

				<PasswordBox x:Name="Password"
							 Grid.Row="1" Grid.Column="1"/>

				<TextBlock Text="Couldn't log you in :("
						   Visibility="{Binding HasErrored, Converter={StaticResource BooleanToVisibility}}"
						   Foreground="#FFAF00"
						   Grid.Row="2" Grid.Column="0"/>

				<StackPanel Orientation="Horizontal"
							HorizontalAlignment="Right"
							Grid.Row="2" Grid.Column="1">
					<ProgressRing IsActive="{Binding IsBusy}"/>
					<Button x:Name="Login"
							Content="Log in with Yammer"/>
				</StackPanel>
			</Grid>
		</Border>
		<StackPanel Grid.Row="3" VerticalAlignment="Bottom">
			<HyperlinkButton x:Name="Attributions" >
				<TextBlock Text="Attributions" Foreground="Black"/>
			</HyperlinkButton>
			
		</StackPanel>

		<VisualStateManager.VisualStateGroups>

			<!-- Visual states reflect the application's view state -->
			<VisualStateGroup x:Name="ApplicationViewStates">
				<VisualState x:Name="FullScreenLandscape"/>
				<VisualState x:Name="Filled"/>

				<!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
				<VisualState x:Name="FullScreenPortrait">
					<Storyboard>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
							<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
						</ObjectAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>

				<!-- The back button and title have different styles when snapped -->
				<VisualState x:Name="Snapped">
					<Storyboard>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
							<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
						</ObjectAnimationUsingKeyFrames>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
							<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
						</ObjectAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>
	</Grid>
</common:LayoutAwarePage>
